<template>
	<view class="history">
		<view class="title">
			<text>历史记录</text>
			<text style="color:red" @tap="delectAll">全部删除</text>
		</view>
		<view class="content">
			<view v-for="(item,index) in list" :key="index" @tap="search(item)">
				<text>{{item}}</text>
				<uni-icons type="closeempty" color="#fff" size="15" @tap.stop="del(index)"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "history",
		data() {
			return {

			};
		},
		props: {
			list: Array
		},
		methods: {
			delectAll() { // 全部删除
				this.$emit('delectAllok');
			},
			del(i) { // 单个删除
				this.$emit('delok', i);
			},
			search(val) {
				// console.log(111);
				this.$emit('search', val);
			}
		}

	}
</script>

<style lang="scss" scoped>
	.title {
		height: 100rpx;
		display: flex;
		align-items: center;
		padding: 0 30rpx;
		justify-content: space-between;
	}

	.content {
		display: flex;
		flex-wrap: wrap;
		padding: 30rpx;
		box-sizing: border-box;

		view {
			font-size: 30rpx;
			color: #fff;
			background-color: #8cd0f5;
			border-radius: 10rpx;
			padding: 6rpx 18rpx;
			margin-right: 20rpx;
			margin-bottom: 20rpx;
			height: 50rpx;
			display: flex;
			align-items: center;
		}

		uni-icons {
			margin-left: 20rpx;
		}
	}
</style>
